#pragma once

#define BUFF_SIZE	(64*1024)
typedef void(*COMMANDPROC)(BYTE cmd, BYTE *data, INT len);

class CClient
{
public:
    CClient();
	BOOL Startup(int port, COMMANDPROC func);
	void Shutdown();
	BOOL SendCommand(BYTE cmd, BYTE *arg, BYTE len);
private:
	static DWORD CALLBACK ThreadProc(LPVOID arg);
	void RecvThread();
private:
	HANDLE m_thread;
	SOCKET m_socket;
	BOOL   m_state;
	BYTE   m_buff[BUFF_SIZE];
	COMMANDPROC m_func;
	SOCKADDR_IN m_addr;
};
